package com.aji.allcommon.utills;

import org.springframework.web.multipart.MultipartFile;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

public class MultipartFileUtill {
    public static FileInputStream multipartTifToJpgFileInputStream(File fileTif) throws IOException {
        BufferedImage bufferedImage = ImageIO.read(fileTif);
        File fileJpg = File.createTempFile("temp",null);
        ImageIO.write(bufferedImage, "jpg", fileJpg);
        return new FileInputStream(fileJpg);
    }
}
